{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-body">
        <form action="{:request()->url()}" class="layui-form" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">到期时间</label>
                <div class="layui-input-inline">
                    <input type="checkbox" name="is_exptime" title="不限时间" lay-filter="exptime">
                </div>
                <div class="layui-input-inline">
                    <input type="text" id="exptime" name="exp_time" value="{$data.exp_time|default=''}" id="exptime" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">所属套餐</label>
                <div class="layui-input-block">
                    <select name="taocan" lay-verify="required">
                        <option value="">请选择套餐</option>
                        {foreach name="taocan" item="v"}
                        <option value="{$v.id}" {if condition="isset($data) and $data.taocan eq $v.id"}selected="selected"{/if}>{$v.name}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <hr>
            <div class="layui-form-item">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" value="{$data.name|default=''}" autocomplete="off" placeholder="" class="layui-input" lay-verify="required">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">联系人</label>
                <div class="layui-input-block">
                    <input type="text" name="contact" value="{$data.contact|default=''}" autocomplete="off" placeholder="" class="layui-input" lay-verify="required">
                </div>
            </div>
            <hr>
            <div class="layui-form-item">
                <label class="layui-form-label">手机号</label>
                <div class="layui-input-block">
                    <input type="text" name="mobile" value="{$data.mobile|default=''}" autocomplete="off" placeholder="" lay-verify="phone|number" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">登陆密码</label>
                <div class="layui-input-block">
                    <input type="password" name="password" value="" autocomplete="off" placeholder="" class="layui-input" lay-verify="required">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-filter="i" lay-submit="">保存</button>
                    <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="js"}
<script type="text/javascript">
    form.on('checkbox(exptime)', function(data){
        if(data.elem.checked == true){
            $('#exptime').hide();
            $('#exptime').attr('value','2080-12-31');
        }else{
            $('#exptime').show();
        }
    });
    <?php $today = date('Y-m-d',time());?>
    laydate.render({
        elem: '#exptime'
        ,min: '{$today}'
        ,max: '2080-12-31'
    });
    
</script>
{/block}
